<me:UIAE03 x:Class="WPFExcelReport.TMEKOPF"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                     xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR"  
                    xmlns:AM="clr-namespace:WPFExcelReport;assembly=TAMSTAMM" 
                    xmlns:AE="clr-namespace:WPFExcelReport;assembly=TMEVAR" 
                   xmlns:KS="clr-namespace:WPFExcelReport;assembly=TKSTSTELL" 
                   xmlns:OP="clr-namespace:WPFExcelReport;assembly=TKSTAGZUO" 
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIAE03.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIAE03.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0"  Grid.ColumnSpan="2" >
            <WrapPanel>
                <WrapPanel Visibility="Collapsed">
                    <Button Click="ResetSeq" Content="{Binding Source={Localization:Translate Word=重置序列号}}"
                    Visibility="{Binding IsITX,Converter={StaticResource bv}}"/>
                </WrapPanel>
                <WrapPanel>
                    <Button  Click="EditCommand" Width="24" Height="20" Margin="5,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24"  Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>

                    <Button Grid.Column="0"  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" Visibility="Collapsed">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                    <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                            IsEnabled="{Binding IsCanNew,ElementName=TV}"
                            >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                    <WrapPanel Visibility="Collapsed">
                        <TextBlock  Text="{Binding Source={Localization:Translate Word=工艺:}}"/>
                        <TextBlock  Text="{Binding MEKEVARHNR}" Width="24" />
                        <TextBlock  Text="{Binding Source={Localization:Translate Word=/}}"/>
                        <TextBlock  Text="{Binding MEKEVARUNR}" Width="24" />
                    </WrapPanel>
                    <WrapPanel>
                        <TextBlock  Text="{Binding Source={Localization:Translate Word=工艺组:}}"/>
                        <ex:TXT72  Text="{Binding MEKBEM1,Converter={StaticResource gb2312}}"  
                               IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"
                       MaxLength="50" Width="200" />
                    </WrapPanel>
                    <WrapPanel>
                        <CheckBox Name="IsMoreMachine" Content="{Binding Source={Localization:Translate Word=更多设备}}" ></CheckBox>
                        <WrapPanel Visibility="{Binding IsChecked,ElementName=IsMoreMachine,Converter={StaticResource bv}}">
                            <AM:TSAM02 KEY="{Binding MACHINEID,ElementName=TV}"
                               KSTKRS="{Binding KSTKRS,ElementName=TV}"
                               KST="{Binding KST,ElementName=TV}"
                               AMTYP="{Binding AMTYP,ElementName=TV}" />

                            <Button  Grid.Column="0"   Click="AE2ALLCommand" Width="24" Height="20"  >
                                <Button.Background>
                                    <ImageBrush  ImageSource="/ImagePackage;component/Images/arrow-down.png" />
                                </Button.Background>
                            </Button>
                            <TextBlock Grid.Column="2" FontSize="16" Text="{Binding Source={Localization:Translate Word=应用}}"/>
                        </WrapPanel>
                    </WrapPanel>
                    <Grid Margin="10,0,0,0" VerticalAlignment="Top"  Visibility="Collapsed"
                      >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <DR:TDRAUFTR  Grid.Column="0" Name="cDR" DocType="{Binding PRTYPE,ElementName=TV}" PrintType="OpenExcel" />
                        <Button  Grid.Column="1"   Click="btnPrint_Click" Height="20" Margin="5,0,0,0" Width="Auto" Content="{Binding Source={Localization:Translate Word=打印确认函}}" />
                    </Grid>
                </WrapPanel>
                <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                    <CheckBox Content="{Binding Source={Localization:Translate Word=按机台}}" IsChecked="{Binding IsByAM,ElementName=TV}"/>
                    <KS:TSKS03 Name="cKS03"
                                    IsEdit="True"
                                    KSTKRS="{Binding KST,ElementName=TV}"
                                    KST="{Binding KST,ElementName=TV}"
                                  />
                    <OP:TSKS05 EXAUF="{Binding KEY,ElementName=cKS03}"
                                   IsEdit="True"
                                  KEY="{Binding AGANG,ElementName=TV}"
                                   />
                </WrapPanel>
                <WrapPanel>
                    <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                        <SD:K0228 IsEdit="True"
                                  KEY="{Binding AMTYP,ElementName=TV}"
                                  />
                        <WrapPanel Visibility="Collapsed">
                            <TextBlock   Text="{Binding Source={Localization:Translate Word=设定}}"/>
                            <ex:TXT72   Margin="5,0,0,0" MaxLength="2" PRE="00" 
                              Text="{Binding DESS,ElementName=TV}" Width="40" />
                            <TextBlock  Text="{Binding Source={Localization:Translate Word=工艺}}"/>
                            <ex:TXT72   Margin="5,0,0,0" MaxLength="2"   PRE="00" 
                              Text="{Binding COLORIT,ElementName=TV}" Width="40" />
                        </WrapPanel>

                        <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                            </Button.Background>
                        </Button>
                    </WrapPanel>
                    <WrapPanel  Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                        <Button  Content="{Binding Source={Localization:Translate Word=获取设备参数}}" Click="GetMachineControls" />
                        <ex:TXT72   Margin="5,0,0,0" MaxLength="2"  IsAutoClear="True" 
                              Text="{Binding KRS,ElementName=TV}" Width="30" />
                        <ex:TXT72   Margin="5,0,0,0" MaxLength="4"  IsAutoClear="True" 
                              Text="{Binding LFD,ElementName=TV}" Width="40" />
                        <ex:TXT72   Margin="5,0,0,0" MaxLength="2"  IsAutoClear="True" 
                              Text="{Binding POS,ElementName=TV}" Width="30" />
                    </WrapPanel>
                    <AM:TAM04STD  ORDERNUM="{Binding MACHINEID,ElementName=TV}"
                            EXAUF="{Binding STDM,ElementName=TV}"
                            KEY="{Binding ART,ElementName=TV}"/>
                </WrapPanel>
                <Expander IsExpanded="False">
                    <TextBlock Text="{Binding MMACHINES,ElementName=TV}"/>
                </Expander>
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1"  Grid.Column="0" 
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"  
                   RowDetailsVisibilityMode="Visible"  
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding MEKEVARUNR}" Header="{Binding Source={Localization:Translate Word=工艺}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding MEKBEM1,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=说明}}" Width="Auto"/>
            </DataGrid.Columns>
        </DataGrid>
        <AE:TMEVAR  Grid.Row="1"    Grid.Column="1"  
                        IsAuto="True"
                       Name="cAE05"
                        IsEdit="{Binding IsEdit,ElementName=TV}" 
                        IsSaved="{Binding IsSaved,ElementName=TV}" 
                       IsByAM="{Binding IsByAM,ElementName=TV}" 
                        MACHINEID="{Binding MACHINEID,ElementName=TV}" 
                       EXAUF="{Binding KEY,ElementName=TV}"
                   />
    </Grid>
</me:UIAE03>
